-
Notifications
You must be signed in to change notification settings - Fork 11
added initialization to CRTHit data members #161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
kjplows
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me thanks! I'll let @PetrilloAtWork decide if using flavours of 0 is better than calling on std::numeric_limits<T> here; my one comment is if any CRT variables are expected to be 0 physically (looking at ts0_ns, x_pos etc) probably std::numeric_limits::lowest() is easier to interpret as nonsense.
PetrilloAtWork
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid GitHub ate my comment.
Which boiled down to: agree with @kjplows, define static constexpr double kInvalidD = std::numeric_limits<double>::lowest(); and kInvalidF for float, use those to initialise, and use -1 as plane value.
"Stupid GitHub" was an euphemism, by the way.
| std::vector<uint8_t> feb_id{}; ///< FEB address | ||
| std::map< uint8_t, std::vector<std::pair<int,float> > > pesmap{}; ///< Saves signal hit information (FEB, local-channel and PE) . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These ones are actually not needed: non-basic types have their constructor called.
| std::vector<uint8_t> feb_id{}; ///< FEB address | |
| std::map< uint8_t, std::vector<std::pair<int,float> > > pesmap{}; ///< Saves signal hit information (FEB, local-channel and PE) . | |
| std::vector<uint8_t> feb_id; ///< FEB address | |
| std::map< uint8_t, std::vector<std::pair<int,float> > > pesmap; ///< Saves signal hit information (FEB, local-channel and PE) . |
| std::string tagger{}; ///< Name of the CRT wall (in the form of strings). | ||
|
|
||
| CRTHit() {} | ||
| CRTHit() = default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just remove this, nobody will miss it.
| CRTHit() = default; |
| float z_err{0.f}; ///< position uncertainty in z-direction (cm). | ||
|
|
||
| std::string tagger; ///< Name of the CRT wall (in the form of strings). | ||
| std::string tagger{}; ///< Name of the CRT wall (in the form of strings). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, std::string constructor will be called and ensures an empty string.
| std::string tagger{}; ///< Name of the CRT wall (in the form of strings). | |
| std::string tagger; ///< Name of the CRT wall (in the form of strings). |
PetrilloAtWork
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stupid GitHub ate my comment.
Which boiled down to: agree with @kjplows, define static constexpr double kInvalidD = std::numeric_limits<double>::lowest(); and kInvalidF for float, use those to initialise, and use -1 as plane value.
"Stupid GitHub" was an euphemism, by the way.
Default initialization values have been introduced for all CRTHit data members. This change ensures that variables are properly initialized at object creation, reducing the risk of undefined behavior and improving code reliability.